package com.molichuxing.services.property;

/**
 * @Author: renzhengyu
 * @Description:
 * @Date: Created in 17:23 2019/9/27
 * @Modified By:
 **/
public enum ContractLogCreatedEnum {
    /**
     * 否
     */
    NO(0, "失败"),
    /**
     * 是
     */
    YES(1, "成功");

    int value;
    String name;

    ContractLogCreatedEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        ContractLogCreatedEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static ContractLogCreatedEnum getEnum(int value) {
        for (ContractLogCreatedEnum enumerate : ContractLogCreatedEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
